package poo.string;

import java.util.*;

public class Espressione {

	private static Scanner sc;

	public static void main(String[] args) {

		String espr = null;
		if (args.length == 1) {
			espr = args[0];
		} else {
			sc = new Scanner(System.in);
			System.out.print("Espr>");
			espr = sc.nextLine();
		}
		StringTokenizer st = new StringTokenizer(espr, "+-*/", true);
		int ris = Integer.parseInt(st.nextToken());
		while (st.hasMoreTokens()) {
			char op = st.nextToken().charAt(0); // ottiene l'operatore
			int num = Integer.parseInt(st.nextToken());
			switch (op) {
			case '+':
				ris = ris + num;
				break;
			case '-':
				ris = ris - num;
				break;
			case '*':
				ris = ris * num;
				break;
			default:
				ris = ris / num;
			}
		}
		System.out.println(espr + "=" + ris);
	}

}
